package com.hl.card.modular.packBack.service.impl;

import com.hl.card.common.persistence.dao.GoodsMapper;
import com.hl.card.common.persistence.model.Goods;
import com.hl.card.common.util.DateUtils;
import com.hl.card.modular.packBack.service.GoodsSevice;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class GoodsSeviceImpl implements GoodsSevice {

    @Resource(name = "goodsMapper")
    private GoodsMapper goodsMapper;

    @Override
    public List<Map<String, Object>> selectList() {
        List<Map<String, Object>> map = goodsMapper.selectGoods();
        return map;
    }

    @Override
    public void save(Goods goods) {

        goods.setAddtime(DateUtils.longToDateAll(System.currentTimeMillis()));
        goodsMapper.insert(goods);
    }

    @Override
    public void delete(int id) {
        goodsMapper.deleteById(id);
    }

    @Override
    public void updateById(Goods goods) {
        goodsMapper.updateById(goods);
    }

    @Override
    public Goods selectById(Integer id) {
        return goodsMapper.selectById(id);
    }

    @Override
    public Goods selectByCode(String goodsCode) {
        Goods goods = goodsMapper.selectByCode(goodsCode);
        return goods;
    }

	@Override
	public List<Goods> selectFoByCode(Map<String, Object> map) {
		//  List<User> list=	userMapper.queryVipManage(map);
		  List<Goods> list=goodsMapper.selectFoByCode(map);
		return list;
	}

	@Override
	public List<Map<String, Object>> selectList(Map<String, Object> map) {
		  List<Map<String, Object>> map1 = goodsMapper.selectGoods();
		return map1;
	}


}
